package com.annotation;

import java.lang.annotation.Annotation;

/**
 * Test--bdqnPractice
 *
 * @author: Jovi
 * @createTime: 2017-08-16 10:01
 **/
public class Test {

    public static void main(String[] args) {
        ApplyAnnotation a1 = new ApplyAnnotation();

        try {
            Annotation[] arr = a1.getClass().getMethod("printStr").getAnnotations();
            for (Annotation ann : arr) {
                if (ann instanceof DefineAnnotation) {
                    System.out.println(ann);
                    System.out.println(((DefineAnnotation)ann).age());
                    System.out.println(((DefineAnnotation)ann).name());
                }
            }
        } catch (NoSuchMethodException e) {
            e.printStackTrace();
        }


    }
}
